<extend name='common@admin/content'/>
<block name="button">
    <div class="nowrap pull-right" style="margin-top:10px">
        <button data-modal='{:url("$classuri/add")}' data-title="添加菜单" data-area="700" class='layui-btn layui-btn-small'><i class='fa fa-plus'></i> 添加菜单</button>
        <button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-small layui-btn-danger'><i class='fa fa-remove'></i> 删除菜单</button>
    </div>
</block>
<block name="content">
    <div class="J_tablelist table_list" data-acturi="{:url('menu/ajax_edit')}">
        <table class="table table-hover">
            <thead>
            <tr>
                <th class='list-table-check-td'>
                    <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
                </th>
                <th class='text-center' width="50">ID </th>
                <th class='text-center' width="50">排 序 </th>
                <th class='text-center' width="50"></th>
                <th>菜单名称</th>
                <th class='visible-lg'>菜单链接</th>
                <th class='text-center'>状态</th>
                <th class='text-center'>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td class='list-table-check-td'>
                        <input class="list-check-box" value='{$vo.id}' type='checkbox'/>
                    </td>
                    <th class='text-center'>
                        {$vo.id}
                    </th>
                    <th class='text-center'>
                        <span data-tdtype="edit" data-field="sort" data-id="{$vo.id}">{$vo.sort}</span>
                    </th>
                    <td class='text-center'>
                        <i style="font-size:18px;" class="{$vo.icon}"></i>
                    </td>
                    <td>{$vo.spl}{$vo.title}</td>
                    <td class='visible-lg'>{$vo.url}</td>
                    <td class='text-center'>
                        <if condition="$vo.status eq 1 and auth($classuri.'/forbid')">
                            <a data-update="{$vo.ids}" data-field='status'  data-value='0'data-action='{:url("$classuri/forbid")}' class="label label-success">已启用</a>
                            <elseif condition="auth($classuri.'/resume')"/>
                            <a data-update="{$vo.ids}" data-field='status'  data-value='1'data-action='{:url("$classuri/resume")}' class="label label-danger" style="cursor: pointer">已禁用</a>
                        </if>
                    </td>
                    <td class='text-center nowrap'>
                        <div class="btn-group btn-group-xs" >
                            <if condition="auth($classuri.'/add') AND substr_count($vo['path'], '-') < 4">
                                <a data-modal='{:url("$classuri/add",array("pid"=>$vo.id))}' data-area="700" href="javascript:void(0)" class="btn  btn-primary">添加子菜单</a>
                                <else/>
                                <a  href="javascript:void(0)" class="btn disabled btn-default">添加子菜单</a>
                            </if>
                            <if condition="auth($classuri.'/edit')">
                                <a data-modal='{:url("$classuri/edit")}?id={$vo.id}' data-area="700" href="javascript:void(0)" class="btn  btn-danger">编辑</a>
                            </if>
                            <if condition=" auth($classuri.'/del') ">
                                <a data-update="{$vo.ids}" data-field='delete' data-action='{:url("$classuri/del")}' href="javascript:void(0)" class="btn  btn-warning">删除</a>
                            </if>
                        </div>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </div>
</block>